<template>
	<view>
		<view>
			<uni-nav-bar shadow left-icon="left" dark title="比价单查询详细" @clickLeft="back()"/>
		</view>
		
		<view>
			<uni-card>
				<uni-row><text style="font-weight: 600;">比价单号:</text>{{from.compareNum}}</uni-row>
				<uni-row><text style="font-weight: 600;">物料总数:</text>{{from.itemQuantity}}</uni-row>
				<uni-row><text style="font-weight: 600;">状态:</text>{{from.statusName}}</uni-row>
				<view style="border: 2px solid chocolate;">
				<uni-row><text style="font-weight: 600;color:chocolate">供应商1:</text>{{from.supplierName1}}</uni-row>
				<uni-row><text style="font-weight: 600;color:chocolate">总报价:</text>{{from.totalMoney1}}</uni-row>
				<uni-row><text style="font-weight: 600;color:chocolate">交期:</text>{{from.transitDate1}}</uni-row>
			    </view>
				<view style="border: 2px solid blueviolet;">
				<uni-row><text style="font-weight: 600;color:blueviolet">供应商2:</text>{{from.supplierName2}}</uni-row>
			    <uni-row><text style="font-weight: 600;color:blueviolet">总报价:</text>{{from.totalMoney2}}</uni-row>
			    <uni-row><text style="font-weight: 600;color:blueviolet">交期:</text>{{from.transitDate2}}</uni-row>
			     </view>
				<view style="border: 2px solid burlywood;">
				<uni-row><text style="font-weight: 600;color: burlywood;">供应商3:</text>{{from.supplierName3}}</uni-row>
			    <uni-row><text style="font-weight: 600;color: burlywood;">总报价:</text>{{from.totalMoney3}}</uni-row>
			    <uni-row><text style="font-weight: 600;color: burlywood;">交期:</text>{{from.transitDate3}}</uni-row>
				</view>
			<view>
				<uni-segmented-control :current="current" :values="items" styleType="button" activeColor="#ffaa00" @clickItem="onClickItem" style="background-color: #fff;margin-top:10rpx;"  />
			</view>
			<view>
		
				<view v-if="current === 0" >
					<view v-for="(item,index) in fromItem" :key="index">
						
						<uni-row><text style="font-weight: 600;">物料编码:</text>{{item.itemCode}}</uni-row>
						<uni-row><text style="font-weight: 600;">物料名称:</text>{{item.itemDesc}}</uni-row>
						<uni-row><text style="font-weight: 600;">规格型号:</text>{{item.specification}}</uni-row>
						<uni-row><text style="font-weight: 600;">物料数量:</text>{{item.itemQuantity}}</uni-row>
						<uni-row><text style="font-weight: 600;">比价数量:</text>{{item.itemCompareQuantity}}</uni-row>
						<view style="border: 2px solid chocolate;">
						<uni-row><text style="font-weight: 600;color:chocolate">供应商一:</text>{{item.supplierName1}}</uni-row>
						<uni-row><text style="font-weight: 600;color:chocolate">单价:</text>{{item.price1}}</uni-row>
						<uni-row><text style="font-weight: 600;color:chocolate">总报价:</text>{{item.totalMoney1}}</uni-row>
						<uni-row><text style="font-weight: 600;color:chocolate">交期:</text>{{item.transitDate1}}</uni-row>
						</view>
						<view style="border: 2px solid blueviolet;">
						<uni-row><text style="font-weight: 600;color:blueviolet">供应商二:</text>{{item.supplierName2}}</uni-row>
						<uni-row><text style="font-weight: 600;color:blueviolet">单价:</text>{{item.price2}}</uni-row>
						<uni-row><text style="font-weight: 600;color:blueviolet">总报价:</text>{{item.totalMoney2}}</uni-row>
						<uni-row><text style="font-weight: 600;color:blueviolet">交期:</text>{{item.transitDate2}}</uni-row>
						</view>
						<view style="border: 2px solid burlywood;">
						<uni-row><text style="font-weight: 600;color: burlywood;">供应商三:</text>{{item.supplierName3}}</uni-row>
						<uni-row><text style="font-weight: 600;color: burlywood;">单价:</text>{{item.price3}}</uni-row>
						<uni-row><text style="font-weight: 600;color: burlywood;">总报价:</text>{{item.totalMoney3}}</uni-row>
						<uni-row><text style="font-weight: 600;color: burlywood;">交期:</text>{{item.transitDate3}}</uni-row>
					     </view>
					</view>
				</view>
			</view>		
			
			
			
			</uni-card>
			
			
		</view>
		
		
	</view>
</template>

<script>
	import {OrderCompareDatatableItem,supplierFormViewRowId} from "@/api/system/user"
	export default {
		data() {
			return {
				current:0,
				from:null,
				fromItem:null,
				items: ['采购明细'],
			}
		},
		onLoad() {
			const eventChannel = this.getOpenerEventChannel();
			eventChannel.on('acceptDataFromOpenerPage', (data) => {
			  this.from = data.data
			  this.get()
			})
		},
		methods: {
			get(){
				OrderCompareDatatableItem(this.from.rowId).then(res=>{
					this.fromItem=res.rows
				})
			},
			back(){
					this.$tab.reLaunch('/pages/work/purchaser/inquiry_review_list')
			},
			onClickItem(e) {
						if (this.current !== e.currentIndex) {
							this.current = e.currentIndex
						}
					},
		}
	}
</script>

<style>

</style>
